package com.yx.cloud.activity;

import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.google.gson.Gson;
import com.iot.sweeper.AppContext;
import com.yx.cloud.R;
import com.yx.cloud.base.BaseActivity;
import com.yx.cloud.bean.CountryCodeBean;
import com.yx.cloud.constant.Constants;
import com.yx.cloud.databinding.CancelaccountActivityBinding;
import com.yx.cloud.utils.CountryCodeUtils;
import com.yx.cloud.utils.Intent_utils;
import com.yx.cloud.utils.LanguageUtils;
import com.yx.cloud.utils.RegularCheckUtils;
import com.yx.cloud.utils.RomUtils;
import com.iot.base.bean.account.Account;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;

public class CancelAccountActivity extends BaseActivity implements View.OnClickListener {
    private static final String TAG = "CancelAccountActivity";
    private Account account;
    private String mPhone, mEmail, mPhone_mEmail, mType, contryCode, mContryCode;
    private String userAccount;
    private CancelaccountActivityBinding binding;

    @Override
    public void onCreate() {
        binding = CancelaccountActivityBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        initData();

    }

    private void initData() {
        userAccount = getIntent().getStringExtra("userAccount");
        binding.ivAccountManagCancelAccountReturn.setOnClickListener(this);
        binding.btnCancelAccountConfirm.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (RomUtils.isFastClick()) {
            return;
        }
        switch (v.getId()) {
            case R.id.iv_accountManag_Cancel_Account_Return:
                Intent_utils.backIntent(this);
                break;
            case R.id.btn_Cancel_Account_Confirm:
                if (userAccount.equals("")) {

                } else {
                    if (RegularCheckUtils.isMobile(userAccount)) {
                        mType = "phoneNumer";
                    } else {
                        if (RegularCheckUtils.isEmail(userAccount)) {
                            mType = "email";
                        } else {
                            Toast.makeText(this, getString(R.string.U_T_Un_NoFormat), Toast.LENGTH_LONG).show();
                            return;
                        }
                    }
                    Intent_utils.enterIntentContextString_3(this, ContinueLogoutActivity.class, "type", mType, "userAccount", userAccount, "contryCode", mContryCode);
                }
                break;
        }
    }

}
